package com.example.hblog.module.service.serviceImpl;

import com.example.hblog.module.dao.RememberDao;
import com.example.hblog.module.pojo.Remember;
import com.example.hblog.module.service.RememberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class RememberServiceImpl implements RememberService {

    @Autowired
    private RememberDao rememberDao;

    @Override
    public void addRemember(Remember remember) {
        try{
            rememberDao.addRemember(remember);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Remember> allRemember() {
        return rememberDao.allRemember();
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Remember> limitRemember() {
        return rememberDao.limitRemember();
    }

    @Override
    public void deleteRemember(String id) {
        rememberDao.deleteRemember(id);
    }

    @Override
    public void clearRemember() {
        rememberDao.clearRemember();
    }
}
